<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 引入样式重置 -->
    <link rel="stylesheet" href="./css/reset.css">
    <!-- 引入字体图标 -->
    <link rel="stylesheet" href="./img/字体图标/iconfont.css">
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        
        ul,
        li {
            list-style: none;
        }
        
        .container {
            width: 1200px;
            margin: 100px auto;
            display: flex;
        }
        
        .container .left .show-box {
            width: 350px;
            height: 350px;
            position: relative;
        }
        
        .container .left .mask {
            position: absolute;
            left: 0;
            top: 0;
            width: 200px;
            height: 200px;
            background-color: rgba(199, 223, 67, 0.5);
            display: none;
            pointer-events: none;
        }
        
        .container .left ul {
            width: 350px;
            display: flex;
            justify-content: space-between;
        }
        /* 放大镜区域 */
        
        .container .right {
            position: relative;
            margin-left: 40px;
            width: 400px;
            height: 400px;
            overflow: hidden;
            border: 1px solid red;
        }
        
        .container .right img {
            position: absolute;
            top: 0;
            left: 0;
        }
        
        .active {
            border: 1px solid blueviolet;
        }
        
        .tu11 img {
            width: 50px;
            height: 50px;
        }
        
        .show-box img {
            width: 350px;
            height: 350px;
        }
    </style>
</head>

<body>
    <div class="container" id="glassone">
        <div class="left">
            <div class="show-box">
                <img src="" alt="显示图片">
                <div class="mask"></div>
            </div>
            <ul class="tu11">

            </ul>
        </div>
        <div class="right">
            <img src="./image/big_1.jpg" alt="大背景图">
        </div>
    </div>

    <!-- jq引入 -->
    <script src="./js/jquery-3.6.0.js"></script>
    <!-- 引入模板引擎 -->
    <script src="./js/template-web.js"></script>
    <script src="./js/glassZoom.js"></script>
    <script>
        box = ''
        sb = [{
                "itemId": 44824435,
                "seq": 0,
                "url": "https://img.alicdn.com/bao/uploaded/i4/1584214999/O1CN01lJKqVA1mnad3Q2a7W_!!0-item_pic.jpg_600x600q90.jpg",
                "height": 800,
                "width": 800,
                "id": 534449841
            }, {
                "itemId": 44824435,
                "seq": 1,
                "url": "https://img.alicdn.com/i1/1584214999/O1CN01UCfLUz1mnaX3ch4Wi_!!0-item_pic.jpg_600x600q90.jpg",
                "height": 800,
                "width": 800,
                "id": 410233699
            }, {
                "itemId": 44824435,
                "seq": 2,
                "url": "https://img.alicdn.com/i2/1584214999/O1CN014qE0Oz1mnaWwb0MoR_!!1584214999.jpg_600x600q90.jpg",
                "height": 800,
                "width": 800,
                "id": 391132959
            }, {
                "itemId": 44824435,
                "seq": 3,
                "url": "https://img.alicdn.com/i1/1584214999/O1CN01nDDfRU1mnaX2As8PC_!!1584214999.jpg_600x600q90.jpg",
                "height": 800,
                "width": 800,
                "id": 391132971
            }, {
                "itemId": 44824435,
                "seq": 4,
                "url": "https://img.alicdn.com/i3/1584214999/O1CN01dT6JzQ1mnaX4KqsvI_!!1584214999.jpg_600x600q90.jpg",
                "height": 800,
                "width": 800,
                "id": 391132982
            }]
            //获取id
        hqsj()
            // 获取商品数据
        function hqsj() {
            // sb.forEach(item => {
            //         console.log(item)
            //     })
            $.ajax({
                url: 'http://www.xiongmaoyouxuan.com/api/detail?id=38564567',
                type: 'get',

                success: function(result) {
                    document.querySelector('.show-box>img').setAttribute('src', result.data.detail.photo[0].url)
                    document.querySelector('.right>img').setAttribute('src', result.data.detail.photo[0].url)
                    result.data.detail.photo.forEach(item => {
                        box += ` <li data-index="1"><img src="${item.url}" alt=""></li>`

                    })
                    console.log(box)
                    document.querySelector('.tu11').innerHTML = box
                    let glass1 = new GlassZoom('#glassone')
                    glass1.moveGlass()
                    glass1.onTabGlass()
                }
            })
        }
    </script>
</body>

</html>